/*
 * Style.java  0.4.0 / Oct 26, 2010
 *
 * Copyright (c) 2010 - 2011, cute4j.com and contributors.
 *
 * This software is licensed under the LGPL version 2.1 license.
 * A copy of this license is included in the file LICENSE-LGPL.txt.
 */
package com.cute4j.swing;

import com.cute4j.swing.styles.Theme;
import com.cute4j.util.Utilities;

/**
 * Style. Replacement for <tt>javax.swing.LookAndFeel class</tt>.
 *
 * @author Slobodan Vrkacevic
 * @version 0.4.0
 */
public abstract class Style {

// Public Methods. -------------------------------------------------------------

  /**
   * Returns the style name.
   *
   * @return the style name
   */
  public abstract String getName();

  /**
   * Returns the style description.
   *
   * @return the style description
   */
  public abstract String getDescription();

  /**
   * Returns <tt>true</tt> if the style is supported on the platform.
   *
   * @return <tt>true</tt> if the style is supported on the platform
   */
  public abstract boolean isSupported();

  /**
   * Returns <tt>true</tt> if the style is platform style.
   *
   * @return <tt>true</tt> if the style is platform style
   */
  public abstract boolean isPlatformStyle();

  /**
   * Returns the style theme.
   *
   * @return the style theme
   */
  public abstract Theme getTheme();

// Overridden Methods. ---------------------------------------------------------

  /**
   * {@inheritDoc}
   */
  public boolean equals(Object obj) {
    if (obj == this) {
      return true;
    }
    if ((obj != null) && (obj.getClass() == getClass())) {
      Style style = (Style)obj;
      return ((isSupported() == style.isSupported()) &&
              Utilities.equals(getName(), style.getName()) &&
              Utilities.equals(getDescription(), style.getDescription()) &&
              Utilities.equals(getTheme(), style.getTheme()));
    }
    return false;
  }

  /**
   * {@inheritDoc}
   */
  public int hashCode() {
    int hashCode = 131;
    String name = getName();
    if (name != null) {
      hashCode = 163 * hashCode + name.hashCode();
    }
    Theme theme = getTheme();
    if (theme != null) {
      hashCode = 163 * hashCode + theme.hashCode();
    }
    return hashCode;
  }

  /**
   * {@inheritDoc}
   */
  public String toString() {
    return getName();
  }

}
